package IOStreamStudy.fileDo;

import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class FileCreatDemo {

    @Test
    public void create00() throws IOException{
        File file0 = new File("D:\\all_projects\\java_projects\\java_ij\\springMVC\\NetWork\\src\\cn\\usts\\edu\\IOStreamStudy\\a.txt");
        if (file0.exists()){
            System.out.println("文件存在");//
        }else {
            file0.createNewFile();
            System.out.println("文件创建成功");
        }

    }

    @Test
    public void create01() throws IOException{
        String dir = "D:\\all_projects\\java_projects\\java_ij\\springMVC\\NetWork\\src\\cn\\usts\\edu\\IOStreamStudy";
        String file = "b.txt";
        File file1 = new File(dir, file);
        if (file1.exists()){
            System.out.println(file+"=存在");
        }else {
            file1.createNewFile();
        }
    }





}
